package pixeleditor.gui;

import java.awt.Dimension;
import java.util.ResourceBundle;

import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;

import common.i18n.ChangeLanguage;
import common.i18n.IChangeLanguage;

import pixeleditor.ctrl.ControlFactory;

@SuppressWarnings("serial")
public class ChooseBackgroundPanel extends JPanel implements IChangeLanguage {

private JButton bg = new JButton("B");
	
	public ChooseBackgroundPanel() {
		ChangeLanguage.addObserver(this);
		initComponents();
		initControls();
	}
	
	private void initComponents() {
		
		setPreferredSize(new Dimension(70,70));
		setLanguage(ChangeLanguage.currentLanguage);
		add(bg);
	}
	
	private void initControls() {
		Action a = (Action) ControlFactory.getControl(ControlFactory.CHOOSE_BACKGROUND_CTRL);
		bg.setAction(a);
	}

	@Override
	public void setLanguage(ResourceBundle rb) {
		setBorder(new TitledBorder(rb.getString("editorBackground")));	
	}
}
